package com.whty.activemq;

//import javax.jms.ConnectionFactory;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.jms.annotation.EnableJms;
//import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
//import org.springframework.jms.config.JmsListenerContainerFactory;

/**
 * @author mario
 * active mq 配置类
 *
 */
//@Configuration
//@EnableJms
public class JmsConfig {
	
	

//	@Bean("jmsQueueListenerContainerFactory")
//    public JmsListenerContainerFactory jmsQueueListenerContainerFactory(ConnectionFactory connectionFactory) {
//        DefaultJmsListenerContainerFactory factory =
//                new DefaultJmsListenerContainerFactory();
//        factory.setConnectionFactory(connectionFactory);
//        //设置连接数
//        factory.setConcurrency("3-10");
//        //重连间隔时间
//        factory.setRecoveryInterval(1000L);
//        factory.setPubSubDomain(false);
//        return factory;
//
//    }
//
//    @Bean("jmsTopicListenerContainerFactory")
//    public JmsListenerContainerFactory jmsTopicListenerContainerFactory(ConnectionFactory connectionFactory) {
//        DefaultJmsListenerContainerFactory factory =
//                new DefaultJmsListenerContainerFactory();
//        factory.setConnectionFactory(connectionFactory);
//        //重连间隔时间
//        factory.setPubSubDomain(true);
//        return factory;
//
//    }
//    
//    /**
//     * 持久订阅
//     */
//    @Bean("jmsTopicListenerContainerFactory2")
//    public JmsListenerContainerFactory jmsTopicListenerContainerFactory2(ConnectionFactory connectionFactory) {
//        DefaultJmsListenerContainerFactory factory =
//                new DefaultJmsListenerContainerFactory();
//        factory.setConnectionFactory(connectionFactory);
//        //重连间隔时间
//        factory.setRecoveryInterval(1000L);
//        factory.setPubSubDomain(true);
//
//        // 给订阅者一个名字,并开启持久订阅
//        factory.setClientId("client_id");
//        factory.setSubscriptionDurable(true);
//        return factory;
//    }

}
